
#ifndef Lines_Entity_h
#define Lines_Entity_h

#include "Vector3.h"
#include "Texture.h"
#include <string>

#define livingIntensityMin      0.02f
#define livingIntensityMax      0.03f
#define livingSpeedMin          1.25f
#define livingSpeedMax          1.6f

class Entity
{
protected:
    Vector2 m_vPosition;
    Vector2 m_vCenter;
    float m_fRotation;
    Vector2 m_vScale;
    
    static int NEXT_ENTITY_ID;
    
    enum tEntityState { Active, Waiting, Dying, ToDelete };
    
    std::string entityName;
    tEntityState entityState;
    int id; 
    
    bool m_bLiving;
    Vector2 m_vLivingIntensity;
    Vector2 m_vLivingSpeed;
    bool m_bInitScaleRead;
    bool m_bLivingInit;
    Vector2 m_vInitScale;
    Vector2 m_vLivingOffset;
    float m_fLivingTime;
    
public:
    bool m_bUpdate;
    bool m_bRender;

    Entity();
    Entity(Vector2 _vPosition);
    ~Entity();
    
    void setup(Vector2 _vPosition);
    
    void setPosition(Vector2 _vPosition) { m_vPosition = _vPosition;}
    void translate(Vector2 _vPosition) { m_vPosition += _vPosition;}
    void setRotation(float _fRotation) { m_fRotation = _fRotation;}
    void setScale(Vector2 _vScale) { m_vScale = _vScale;}
    void setCenter(Vector2 _vCenter) { m_vCenter = _vCenter;}
    void setCentered() { m_vCenter = Vector2(0.5f, 0.5f);}

    void setRender(bool _bRender) { m_bRender = _bRender;}
    void setUpdate(bool _bUpdate) { m_bUpdate = _bUpdate;}
    
    Vector2 getPosition() { return m_vPosition; }
    Vector2 getCenter() { return m_vCenter; }
    float getRotation() { return m_fRotation; }
    Vector2 getScale() { return m_vScale;}
    std::string getEntityName() { return entityName; }
    
    bool isUpdate() { return m_bUpdate;}
    bool isRender() { return m_bRender;}
    
    void update();
    virtual void render();
    virtual void render(Vector2 _vOffset);
    
    void setLiving(bool _bLiving){m_bLiving = _bLiving;}
    void setLivingIntensity(Vector2 _vIntensity){ m_vLivingIntensity = _vIntensity; }
    void setLivingSpeed(Vector2 _vSpeed){ m_vLivingSpeed = _vSpeed; }
    
private:
    
    void initLiving();
    
};

#endif
